package domain

import (
	"context"
	"errors"
	"github.com/zeromicro/go-zero/core/logx"
	"listenboos-common/db"
	"ucenter/dao"
	"ucenter/model"
	"ucenter/repo"
)

type VipConfigDomain struct {
	vipConfigRepo repo.VipServiceConfigRepo
}

func (u *VipConfigDomain) FindAll(ctx context.Context) (vipConfigs []*model.VipServiceConfig, err error) {
	vipConfigs, err = u.vipConfigRepo.FindAll(ctx)
	if err != nil {
		logx.Error(err)
		return nil, errors.New("数据库异常")
	}
	return vipConfigs, err
}
func NewVipConfigDomain(db *db.ListenDB) *VipConfigDomain {
	return &VipConfigDomain{
		vipConfigRepo: dao.NewVipConfigDaoDao(db),
	}
}
